package com.xjw.coreutil.entity;

import cn.hutool.core.lang.UUID;
import com.xjw.coreutil.http.JsonUtil;
import lombok.Data;

/**
 * @author 徐军文
 * @since 2021/11/9 22:09
 */
@Data
public class WebSocketData {

    private String uuid;
    private String userId;
    private String userName;
    private int type;
    // 目的用户id
    private String targetId;
    private Object data;

    public WebSocketData() {
        this.uuid = UUID.fastUUID().toString(true);
    }

    public String toJson() {
        return JsonUtil.objectToString(this);
    }
}
